import { type ListData } from "@/types";
import { del, get, post, put } from ".";
import type {
  Category,
  CategoryFilter,
  CategoryModify,
} from "@/types/category";

export const getCategory = (param: CategoryFilter) => {
  return get<ListData<Category>>("/category", param);
};

export const addCategory = (payload: CategoryModify) => {
  return post<void>("/category", payload);
};

export const delCategory = (id: number) => {
  return del<void>(`/category/${id}`);
};

export const updateCategory = (payload: CategoryModify) => {
  return put<void>(`/category`, payload);
};
